//var nowDate = getDay(0);
//var pageType = sessionStorage.getItem('pageType');
//if(pageType == '' && sessionStorage.getItem("pageType") != 'null' && sessionStorage.getItem("pageType") != null){
//	pageType = sessionStorage.getItem("pageType");
//}
//var corp = GetQueryString('corp')==null?"":GetQueryString('corp');
//if(corp==''){
//	corp = sessionStorage.getItem("corp");
//}else{
//	sessionStorage.setItem("corp",corp);
//}
//var shopcode = GetQueryString('shopcode')==null?"":GetQueryString('shopcode');
//var startDate = GetQueryString('startDate')==null?nowDate:GetQueryString('startDate');
//var endDate = GetQueryString('endDate')==null?nowDate:GetQueryString('endDate');
//var calendar1 = new lCalendar();
//var calendar2 = new lCalendar();
//var url;
//calendar1.init({
//	'trigger': '#startDate',
//	'type': 'date',
//	'minDate': '2022-01-01',
//	'maxDate': nowDate
//});
//calendar2.init({
//	'trigger': '#endDate',
//	'type': 'date',
//	'minDate': '2022-01-01',
//	'maxDate': nowDate
//});
//function ICalendarClick(){
//	if($('#startDate').val() <= $('#endDate').val()){
//		startDate = $('#startDate').val();
//		endDate = $('#endDate').val();
//	}else{
//		$('#startDate').val(startDate);
//		$('#endDate').val(endDate);
//		dd.ready(function(){
//			dd.device.notification.alert({
//				message: '开始日期不能大于结束日期',
//				title: "提示",//可传空
//				buttonName: "确定",
//				onSuccess : function() {
//					
//				},
//				onFail : function(err) {}
//			});
//		});
//	}
//}
var everyId = GetQueryString('everyId')==null?"0":GetQueryString('everyId');
$(document).ready(function(){
	$('#shopcodeshow').text(sessionStorage.getItem("shopcode"));
	$('#shopnameshow').text(sessionStorage.getItem("shopname"));
//	$('#startDate').val(startDate);
//	$('#endDate').val(endDate);
//	if(shopcode != ''){
//		$('#shopcode').val(shopcode);
//		$('#shopcode').attr('readonly','readonly');
//	}
//	$('#searchButton').on('click',function(){
//		getJianchaJieguo();
//	});
	getJianchaJieguo();
});

//查询门店信息
function getJianchaJieguo(){
	showloading();
	var sendData = {};
//	sendData.shopcode=$('#shopcode').val();
//	sendData.startDate=startDate;
//	sendData.endDate=endDate;
//	sendData.notflag='0';
	sendData.everyId = everyId;
//	if(pageType == 'yingyun'){
//		sendData.jobnumber=sessionStorage.getItem("jobnumber");
//		sendData.job=sessionStorage.getItem("job");
//	}
//	if(pageType == 'pandian'){
//		sendData.wanchengUser=sessionStorage.getItem("userId");
//	}
	$.ajax({
		url: "getHuodong_jiancha_jd_every_item"
		,type:'post'
//		,async: false
		,data:JSON.stringify(sendData)
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			console.log(res)
			$('#opeTable').empty();
			try {
				if(res.success){
					var resdata = res.data;
					for (var i = 0; i < resdata.length; i++) {
						$('#opeTable').append('<tr class="thin-border-bottom">'
								+'	<td id="itemname'+i+'" class="orange" style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].itemname+'</td>'//id="'+el+obj+i+'"
								+'	<td id="biaozhun'+i+'" class="orange" style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].itembiaozhun+'</td>'//id="'+el+obj+i+'"
								+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].maxScore+'</td>'//id="'+el+obj+i+'"
								+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].score+'</td>'//id="'+el+obj+i+'"
								+'</tr>');
					}
					
				}else{
					$('#opeTable').append('<tr class="thin-border-bottom">'
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">--</td>'
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">--</td>'//id="'+el+obj+i+'"
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">--</td>'//id="'+el+obj+i+'"
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">--</td>'//id="'+el+obj+i+'"
							+'</tr>');
				}
				//点击显示详情
				$('#opeTable td[id]').on("click",null,function(){
					var html = $(this).html();
					var id = $(this).attr("id");
					var value = $(this).text();
					if(value != undefined){
						//tips层-上
						layer.tips(value, '#'+id, {
							tips: [1, '#0FA6D8'] //还可配置颜色
						});	
					}
					
				});
			} catch (e) {
				console.log(e);
			} finally{
				hideloading();
			}
			
		}
		,error:function(XMLHttpRequest, textStatus, errorThrown) {
			 console.log(XMLHttpRequest);
			 console.log(textStatus);
			 console.log(errorThrown);
			 hideloading();
		}
	});
	
}

//检查详情
function jianchaItem(everyId,shopcode,shopname){
	sessionStorage.setItem("shopcode",shopcode);
	sessionStorage.setItem("shopname",shopname);
	window.location.href='toJiancha_jieguo_item?everyId='+everyId;
}